package img

import (
	"common/mildware"
	"common/router"
	"github.com/gin-gonic/gin"
	"project/pkg/dao/mysql"
	"project/pkg/dao/redis"
)

type IRouter struct {
}
type IHandler struct {
	M mysql.Mysql
	R redis.Redis
}

func NewIHandler() IHandler {
	return IHandler{
		M: mysql.NewMysql(),
		R: redis.NewRedis(),
	}
}
func init() {
	router.AddRouter(new(IRouter))
}
func (IRouter) Router(e *gin.Engine) {
	handler := NewIHandler()
	img := e.Group("/img")
	img.GET("/down", handler.DownImg)
	img.Use(mildware.JWTAuthMiddleware())
	img.POST("/up", handler.UpImg)
	img.POST("/search", handler.SearchImgByAuthorId)
	img.POST("/delete", handler.DeleteImg)
}
